﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05.CalculateWorkDays
{
    class CalculateWorkDays
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter a date to see the number of working days between today and your date");
            Console.WriteLine("Enter year:");
            int year = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter month:");
            int month = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter day:");
            int day = int.Parse(Console.ReadLine());
            DateTime startDay = DateTime.Today;
            DateTime endDay = new DateTime(year, month, day);
            int daysBetween = 0;
            daysBetween = Math.Abs((endDay - startDay).Days);
            if (startDay > endDay)
            {
                startDay = endDay;
                endDay = DateTime.Today;
            }
            DateTime[] holidays ={
                                    new DateTime(2013, 12, 24),
                                    new DateTime(2013, 1, 3),
                                    new DateTime(2013, 9, 9),
                                    new DateTime(2013, 9, 22),
                                    new DateTime(2013, 5, 24)
                                 };
            int workDaysCount = 0;
            bool holiday = false;
            for (int i = 0; i < daysBetween; i++)
            {
                startDay = startDay.AddDays(1);
                if (startDay.DayOfWeek != DayOfWeek.Sunday && startDay.DayOfWeek != DayOfWeek.Saturday)
                {
                    for (int j = 0; j < holidays.Length; j++)
                    {
                        if (startDay == holidays[j])
                        {
                            holiday = true;
                            break;
                        }
                    }
                    if (holiday==false)
                    {
                        workDaysCount++;
                    }
                    holiday = false;
                }
            }
            Console.WriteLine(workDaysCount);
        }
    }
}   
    
